#include <iostream>
#include "server_socket.h"
#include "string.h"
#include <unistd.h>
#include "SendVid.h"
#include "camera_sample.h"
static constexpr int ASR_TAKE_PHOTO = 0;
static constexpr int ASR_TAKE_RECORD = 1;
static constexpr int ASR_SEND_VID = 2;

void CameraAsrResult(int cmd)
{

    if (cmd == ASR_TAKE_PHOTO) {
        takephoto();
    } else if (cmd == ASR_TAKE_RECORD) {
        takerecord();
    }else if (cmd == ASR_SEND_VID){
        SendVid();
    }
}


static int CameraGetAsrResult( const char *msg)
{
    const char *AsrMsg[] = {
            "Take Photo",
            "Take Record",
            "Send Vid"
    };
    const int nbr = 2;


    for (int i =0; i < nbr; i++) {
        if (strcmp(msg, AsrMsg[i]) == 0) {
            CameraAsrResult(i);
            break;
        }
    }

    return 0;
}



int main() {

    printf("before ServerSocketStart ############### \n\n");
    ServerSocketStart(CameraGetAsrResult);
    printf("after ServerSocketStart ############### \n\n");


    std::cout << "Hello, World!" << std::endl;

    while (1){
        sleep(1);
    }
    return 0;
}

